<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<ui:composition>
    <h:form>
        <p:messages showDetail="true" autoUpdate="true" closable="true"/>
        <h:panelGrid columns="2">
            <p:outputLabel value="Description"/>
            <p:inputTextarea value="#{documentsBean.document.description}"/>

            <p:outputLabel value="Storage life (0 - infinitely)"/>
            <h:inputText type="number" value="#{documentsBean.document.storageLife}">
                <f:convertNumber integerOnly="true" type="number"/>
                <f:validateLongRange minimum="0" maximum="365"/>
            </h:inputText>

            <p:outputLabel value="Permissions"/>
            <h:selectOneMenu value="#{documentsBean.document.permissions}">
                <f:selectItem itemLabel="For all" itemValue="0"/>
                <f:selectItem itemLabel="Only for me" itemValue="1"/>
            </h:selectOneMenu>
        </h:panelGrid>
        <p:commandButton value="Save" action="#{documentsBean.save}"/>

        <p:commandButton value="Back" action="#{navigationBean.action('document.xhtml')}"/>
    </h:form>
</ui:composition>
</html>
